package com.zzyy.study.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.InitBinder;

/**
 * @auther zzyy
 * @create 2025-01-03 13:47
 */
@ControllerAdvice
@Slf4j
public class DemoControllerAdvice
{
    @InitBinder
    public void init(WebDataBinder binder) {
        log.info("ControllerAdvice init 进入");
    }

    @ExceptionHandler(Exception.class)
    public String handleException(Exception e) {
        log.info("ControllerAdvice handleException 进入");
        return "error";
    }
}
